<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>应急信息发布项目审核查看</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link href="../../layui/css/iconfont/iconfont.css" rel="stylesheet" type="text/css">
    <link href="../../layui/css/layui.css" rel="stylesheet" type="text/css">
    <link href="../../css/style.css" rel="stylesheet" type="text/css">
    <script src="../../layui/layui.js"></script>
    <script src="../../js/jquery-1.8.3.js"></script>
    <script src="../../js/util.js"></script>
    <script>
        var checkId;
        layui.use(['form', 'jquery', 'element', 'laydate', 'layer'], function () {
            var form = layui.form;
            var $ = layui.$;
            var laydate = layui.laydate;
            var layer = layui.layer;
            var mgrId = getUrlParam("mgrId");
            var cityId = getUrlParam("cityId");
            var user ;
            laydate.render({
                elem: '#startTime'
            });
            laydate.render({
                elem: '#endTime'
            });
            $('#yes').on('click', function (){
                check("1");
            });
            $('#back').on('click', function (){
                window.location.href="xuYiLinePointCheckManage.html";
            });
            $('#no').on('click', function () {
                check("2");
            });
            function check(checkState){
                let param = {
                    "checkId": checkId,
                    "checkState": checkState,
                    "checkRemark": $("#remark").val()
                };
                const url = '/xuYiLinePointCheck/checkLinePoint';
                $.ajax({
                    type: 'post',
                    url: url,
                    data: JSON.stringify(param),
                    contentType:"application/json;charset=UTF-8",
                    beforeSend: function () {
                        if ($("#remark").val() == "") {
                            layer.msg("审核说明不能为空");
                            return false;
                        }
                        loading = layer.load(0, {shade: false});
                    },
                    success: function (json) {
                        layer.close(loading);
                        var data = json.data;
                        if (json.retCode == 0) {
                            layui.use('layer', function () {
                                layer.open({
                                    content:'审核成功，点击确定按钮返回审核管理界面'
                                    , btn: ['确定']
                                    ,closeBtn:0
                                    , yes: function (index) {
                                        layer.close(index);
                                        location.href = "xuYiLinePointCheckManage.html";
                                    }
                                });
                            });
                        } else {
                            layer.msg(json.msg);
                        }
                    },
                    error: function (data) {
                        layer.msg('系统异常，请联系管理员处理!');
                    }
                });
            }
            function  findUserDuty() {
                $.ajax({
                    type: 'post',
                    async: false,
                    url: '/util/findUser',
                    success: function (json) {
                        user=json;
                    }, error: function () {
                        layer.msg('系统异常，请联系管理员处理!');
                    }
                });
            }

            function jugdeDuty(){
                var userDuty = user.userDuty;
                if(userDuty=="6"||userDuty=="0"){
                    $('#yes')[0].style("display",'');
                    $('#no')[0].style("display",'');
                }
            }

            //页面数据初始化
            $(document).ready(function () {
                findUserDuty();
                jugdeDuty();
                checkId = getUrlParam("checkId");
                var url = '/xuYiLinePointCheck/qryCheckInfoWithId?checkId='+checkId;
                $.ajax({
                    type: 'post',
                    url: url,
                    beforeSend: function () {
                        loading = layer.load(0, {shade: false});
                    },
                    success: function (json) {
                        layer.close(loading);
                        var data = json.data;
                        console.info(data)
                        //$("#startTime").val(data.startDate);
                        //$("#endTime").val(data.endDate);
                        $("#checkType").val(data.typeName);
                        $("#operator").val(data.operator);

                        if (data.type ==="1" ||data.type ==="2"|| data.type ==="3" ){
                            $("#label1").text("点位名称");
                            $("#label2").text("点位经纬度");
                            $("#content1").val(data.pointName);
                            $("#content2").val(data.gpsItdu);
                            if(data.type ==='3'){
                                $("#pointRel")[0].style.display = "none";
                            }
                        } else if(data.type ==="4" ||data.type ==="5"|| data.type ==="6") {
                            $("#label1").text("线路名称");
                            $("#label2").text("关联点位");
                            $("#content1").val(data.lineName);
                            $("#content2").val(data.pointName);
                            if(data.type ==='6'){
                                $("#pointRel")[0].style.display = "none";
                            }
                        }


                        if (data.checkState==0){
                            $("#yes")[0].style.display = "inline-block";
                            $("#no")[0].style.display = "inline-block";
                            $("#back")[0].style.display = "none";
                        } else {
                            $("#yes")[0].style.display = "none";
                            $("#no")[0].style.display = "none";
                            $("#back")[0].style.display = "inline-block";
                            $("#remark").prop("disabled",true);
                            $("#remark").val(data.checkRemark);
                        }
                        console.info(user.duty);
                        if(user.duty ==7){
                            console.info("111");
                            $("#yes")[0].style.display = "none";
                            $("#no")[0].style.display = "none";
                            $("#back")[0].style.display = "inline-block";
                            $("#remark").prop("disabled",true);
                        }

                    }
                    ,
                    error: function (data) {
                        layer.msg('系统异常，请联系管理员处理!');
                    }
                });
            });
        });
    </script>
</head>
<body>
<div class="layui-html-limit">
    <div class="layui-content-body">
        <div class="scroll-box">
            <div class="breadcrumb-box">
              <span class="layui-breadcrumb" lay-separator="|">
     <a href="javascript:returnIndex2()">首页&nbsp;</a>
     <a href="#">&nbsp;线路点位审核&nbsp;</a>
</span>
            </div>
            <div class="content-box">
                <div class="layui-form layui-form-pane" action="">
                    <div class="layui-form-item">
                        <div class="layui-block" pane="">
                            <label class="layui-form-label">审核类型</label>
                            <div class="layui-input-block">
                                <input type="text" style="width:auto"
                                       id="checkType" autocomplete="off" class="layui-input" disabled>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-block" pane="">
                            <label class="layui-form-label">操作人</label>
                            <div class="layui-input-block">
                                <input type="text" style="width:auto"
                                       id="operator" autocomplete="off" class="layui-input" disabled>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-block" pane="">
                            <label class="layui-form-label" id="label1"></label>
                            <div class="layui-input-block">
										<textarea placeholder="" class="layui-textarea"
                                                  style="width: 30%" id="content1" disabled></textarea>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item" id = 'pointRel'>
                        <div class="layui-block" pane="">
                            <label class="layui-form-label" id="label2"></label>
                            <div class="layui-input-block">
										<textarea placeholder="" class="layui-textarea"
                                                  style="width: 30%" id="content2" disabled></textarea>
                            </div>
                        </div>
                    </div>

                    <!--  <div class="layui-form-item">
                <div class="layui-block">
                    <label class="layui-form-label" style="width: auto">发送起止时间</label>
                    <div class="layui-input-inline">
                        <input type="text" name="date" id="startTime" autocomplete="off" class="layui-input"
                               disabled>
                    </div>
                    <div class="layui-form-mid">-</div>
                    <div class="layui-input-inline">
                        <input type="text" name="date" id="endTime" autocomplete="off" class="layui-input"
                               disabled>
                    </div>
                </div>
            </div> -->
                    <div class="layui-form-item">
                        <label class="layui-form-label">审核说明</label>
                        <div class="layui-input-block">
									<textarea placeholder="请输入内容" class="layui-textarea"
                                              style="width: 30%" id="remark"></textarea>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <button class="layui-btn layui-btn-normal" id="yes">审核通过</button>
                        <button class="layui-btn layui-btn-danger" id="no">审核不通过</button>
                        <button class="layui-btn layui-btn-normal" id="back" style="display:none">返回</button>
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>
</div>

</body>
</html>